package br.com.regex;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class ExemploBasico {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		String target  = "Jim?and Timteste?";
		String pattern = "[?]";
		Pattern p = Pattern.compile(pattern);
		StringBuffer sb = new StringBuffer();
		
		
		Matcher m = p.matcher(target);
				
		System.out.println(Pattern.matches(pattern, target));
		
		while (m.find()){
			System.out.println(target.substring(m.start(),m.end()));
			//System.out.println(1);
			//m.appendReplacement(sb, "bunda");
			
		}
		//m.appendTail(sb);
		System.out.println(sb);
		

	}

}
